package com.example.employee.mapper;

import com.example.employee.domain.po.Advertisement;
import com.example.employee.domain.vo.AdvertiseVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface AdvertisementMapper {
    /**
     * 获取广告信息
     * @param position
     * @return
     */
    @Select("select id, name,image_url,link_url from advertisement where position = #{position} order by sort_order desc")
    List<AdvertiseVO> selectAdvertise(Integer position);
    @Insert("insert into advertisement(name,image_url,link_url,position,start_time,end_time,status," +
            "sort_order,creater,updater,created_at,updated_at) values" +
            "(#{name},#{imageUrl},#{linkUrl},#{position},#{startTime},#{endTime},#{status},#{sortOrder}," +
            "#{creater},#{updater},#{createdAt},#{updatedAt})")
    void insert(Advertisement advertisement);

}
